﻿using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;

public class SubjectiveToggle : Toggle 
{
    [SerializeField]
    List<CommandSubject> m_subjects = new List<CommandSubject>();
    public List<CommandSubject> subjects { get { return m_subjects; } }


    protected override void OnEnable()
    {
        base.OnEnable();
        onValueChanged.AddListener(InvokeSubjects);
        // .AddListener(InvokeSubjects);
    }

    void InvokeSubjects(bool value)
    {
        if (value) subjects.ForEach(s => s.Invoke());
    }

    protected override void OnDisable()
    {
        base.OnDisable();
        onValueChanged.RemoveAllListeners();
    }

}
